from utility.VTService import VTService
import time


vt_service = VTService()

file_name = 1


vt_api_keys = [
    "76ebd939301445249b9dfd7bb58e8be4d85f572de382cd6eceeb4a56ad7587f6",
    "583680f214840a461ead2cec8fae769c1eb3ee5461e362455e0d6daf38be12db",
    "02e4d9d35863b2c2e057289311bbd37f2eb21a7dd2496a04d298b3e680de2fd5",
    "a2db6727abaf1f4908d2d422c15371d25c9bc7debdc0fd23a4f50426d24e5a96",
    "ab8421085f362f075cc88cb1468534253239be0bc482da052d8785d422aaabd7",
    "ac6f89d4a5f58fa8d539d0e07de38d4f73012954348123d5cfdaa63f503ad706",
    "72b066aa76a58a2a29e0bc58fb85271e9a4222c552ecf97701f8526edd49670f",
    "d92949f61388b91e18c5c75a0c668e7cc512039b719d2d5523266e843982a599",
    "7d0967f369b915aceec2b784c7d425f6c113e0b2713d4c221e78d9b507e9eeb7",
    "6d179b22ca63010c75c01e0df2e6f2b5492b1b17d61fd036498b8c65a14e5c3f",
    "a2114d52e027e3cbe908f75eef6343e2210918cd348e360d9ba523f52ae6a227",
    "35008f6f8c59a23e388fea8128618bb3ceb17b6b3b34003dbdb6025d44c31819",
    "0202c928cb410a25b09b6c635aab89b86fed89446c7f34d8167985bdcdda17a4"
    ]





index = 0

vt_api_key_index = 0

for i in range(264):

    if i < 262:
        continue

    file = open("destination/malware_hascode/" + str(i), "r")
    vt_result_file = open("destination/malware_vt_result/" + str(i), "w")

    print("FileName : " + str(i))

    for line in file:
        index = index + 1
        vt_api_key = vt_api_keys[vt_api_key_index]
        response = vt_service.fetch_engine_values(line.strip(), vt_api_key)
        print(str(time.strftime("%H-%M-%S")) + ": " + str(index) + ": " + vt_api_key + ": " + response)

        vt_api_key_index = vt_api_key_index + 1

        if vt_api_key_index == len(vt_api_keys):
            vt_api_key_index = 0

        try:
            vt_result_file.write(response + "\n")
        except Exception as e:
            vt_result_file.write("Error\n")
            print(e)

        time.sleep(0.5)

    vt_result_file.close()
    file.close()

# a.farukyazi = 72b066aa76a58a2a29e0bc58fb85271e9a4222c552ecf97701f8526edd49670f
# testafy1 = 35008f6f8c59a23e388fea8128618bb3ceb17b6b3b34003dbdb6025d44c31819
# testAfy2 = d92949f61388b91e18c5c75a0c668e7cc512039b719d2d5523266e843982a599
# testAfy3 = 76ebd939301445249b9dfd7bb58e8be4d85f572de382cd6eceeb4a56ad7587f6
# testAfy4 = 583680f214840a461ead2cec8fae769c1eb3ee5461e362455e0d6daf38be12db
# testAfy5 02e4d9d35863b2c2e057289311bbd37f2eb21a7dd2496a04d298b3e680de2fd5
# tbtk 7d0967f369b915aceec2b784c7d425f6c113e0b2713d4c221e78d9b507e9eeb7
# şehir 6d179b22ca63010c75c01e0df2e6f2b5492b1b17d61fd036498b8c65a14e5c3f
# deneme01 a2114d52e027e3cbe908f75eef6343e2210918cd348e360d9ba523f52ae6a227
# deneme002 a2db6727abaf1f4908d2d422c15371d25c9bc7debdc0fd23a4f50426d24e5a96
# deneme003 ab8421085f362f075cc88cb1468534253239be0bc482da052d8785d422aaabd7
# deneme0004 ac6f89d4a5f58fa8d539d0e07de38d4f73012954348123d5cfdaa63f503ad706
# deneme0005 0202c928cb410a25b09b6c635aab89b86fed89446c7f34d8167985bdcdda17a4